package com.legna.mhxy.support.controller;

import com.legna.mhxy.support.service.AnalysisService;
import com.legna.mhxy.support.service.UserRingService;
import com.legna.mhxy.support.utils.Result;
import com.legna.mhxy.support.vo.UserRingVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name="用户环")
@RestController
@RequestMapping("/user/ring")
@AllArgsConstructor
public class UserRingController {

    private final UserRingService userRingService;

    @GetMapping
    @Operation(summary = "查询")
    public Result<List<UserRingVO>> getUserRings(@RequestParam("userId")Long userId,
                                                @RequestParam(value = "categoryId",required = false) Long categoryId,
                                                @RequestParam(value = "categoryType",required = false) Integer categoryType,
                                                @RequestParam(value = "grade",required = false) Integer grade) {
        List<UserRingVO> userRings = userRingService.getUserRings(userId,categoryId,categoryType,grade);
        return Result.ok(userRings);
    }
    @GetMapping("/{id}")
    @Operation(summary = "查询")
    public Result<UserRingVO> getUserRing(@PathVariable("id")Long id) {
        UserRingVO userRing = userRingService.getUserRing(id);
        return Result.ok(userRing);
    }
}
